<template>
  <view>
    <Header type="back" :to="back"></Header>
    <swiper
      class="swiper w-100 h624"
      @change="change"
      :indicator-dots="indicatorDots"
      :autoplay="autoplay"
      :interval="interval"
      :duration="duration"
    >
      <swiper-item v-for="(item, index) in detailsPic" :key="index">
        <ImgFile :url="baseUrl + item" className="w-100 h624"></ImgFile>
      </swiper-item>
    </swiper>
    <SwiperBot
      class="re bottom102"
      :current="current"
      :list="detailsPic"
    ></SwiperBot>

    <view
      class="bg-f8ff w-100 re pt-6"
      style="margin-top: -80rpx; /* border-radius: 0 80rpx 0 0; */"
    >
      <!-- <Horn type="left-top"></Horn> -->
      <view class="w-100 px-5">
        <view class="font45 font700 t-20">
          {{ type ? item.goodsName || "" : item.name || "" }}
        </view>
        <view class="f-b-e h68 font40">
          <view v-if="type">
            <text class="font28 mr-05"></text>
            <text class="font700 font28 t-20"
              >{{ item.integral || "0" }} 积分</text
            >
          </view>
          <view v-else>
            <text class="font28 mr-05">¥</text>
            <text class="font700 t-20">{{ item.price || "0" }}</text>
          </view>
          <view>
            <slot name="item_title"></slot>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
import Horn from "../../../components/horn.vue";
import Header from "../../../components/header.vue";
import SwiperBot from "../../../components/swiper-bot.vue"; // swiper面板
import ImgFile from "../../../components/img_file.vue";
export default {
  components: { Horn, Header, SwiperBot, ImgFile },
  props: {
    item: {},
    back: {},
    type: {},
  },
  data() {
    return {
      baseUrl: `${uni.getStorageSync("file") || ""}/file`,
      indicatorDots: true,
      autoplay: true,
      interval: 6000,
      duration: 500,
      detailsPic: [],
      path: "",
      current: 0,
    };
  },
  watch: {
    item() {
      this.set_pic();
    },
  },
  created() {
    this.path = uni.getStorageSync("host") || "";
    this.set_pic();
  },
  methods: {
    change(e) {
      this.current = e.detail.current;
    },
    set_pic() {
      this.detailsPic = this.item.pic?.split(",") || [];
    },
  },
};
</script>

<style></style>
